#ifndef SAW_H
#define	SAW_H

#include <cstdlib>
#include <vector>

class SAW {
public:
	SAW(unsigned long* stepSizes, size_t amountStepSizes, unsigned int seed);
    unsigned long walk();

    struct Point {
        long x, y, z, u;
    };
private:
    static const long startX = 0;
    static const long startY = 0;
    static const long startZ = 0;
    static const long startU = 0;
    std::vector<Point> path;
    unsigned long directions;
    unsigned long stepSize;
    unsigned long* stepSizes;
    size_t stepSizeCounter;
    size_t amountStepSizes;
    bool* possibleDirections;

    unsigned long calculatePossibleDirections(Point point);
    unsigned long getDirection(unsigned int number);
    void doStep(Point oldPoint, Point newPoint);
    bool canGoNord(Point point);
    bool canGoEast(Point point);
    bool canGoSouth(Point point);
    bool canGoWest(Point point);
    bool canGoUp(Point point);
    bool canGoDown(Point point);
    bool canGoUp4(Point point);
    bool canGoDown4(Point point);
    unsigned long newStepSize();
    bool pathContains(Point point);
    void doStepNord(Point oldPoint, Point newPoint);
    void doStepSouth(Point oldPoint, Point newPoint);
    void doStepEast(Point oldPoint, Point newPoint);
    void doStepWest(Point oldPoint, Point newPoint);
    void doStepUp(Point oldPoint, Point newPoint);
    void doStepDown(Point oldPoint, Point newPoint);
    void doStepUp4(Point oldPoint, Point newPoint);
    void doStepDown4(Point oldPoint, Point newPoint);
};

#endif	/* SAW_H */
